<div class="modal-dialog">
	<div class="modal-content">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			<h4 class="modal-title" id="myModalLabel"><b>驳回原因</b></h4>
		</div>
		<div class="modal-body form-horizontal">
			<input type="hidden" name="task_id" id="sendback_task_id" value="{$task_id}"/>
			<div class="form-group">
				<label for="name" class="col-sm-2 control-label">概述</label>
				<div class="col-sm-5">
					<input type="text" name="title" id="sendback_title" class="form-control">
				</div>
			</div>
			<div class="form-group">
				<label for="name" class="col-sm-2 control-label">理由</label>
				<div class="col-sm-10"><textarea name="content" class="form-control" id="sendback_content" style="min-height:100px;"></textarea></div>
			</div>
			<div class="modal-footer">
				<input type="button" id="sendback_submit" class="btn btn-primary"  value="确定" />
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	/**
	 * Ajax提交退还申请，如果成功，则任务状态按钮设置为不可用
	 * @param string status_type : 'send_back'  标识提交的请求是驳回退还申请操作
	 * @param string select_option_value 驳回后，改变任务状态为当前选择的任务状态
	**/
	$('#sendback_submit').click(function(){
		var task_id = $('#sendback_task_id').val();
		var title = $('#sendback_title').val();
		var content = $('#sendback_content').val();
		var select_option_value = $("#select_status option:selected").val();
		
		$.ajax({
			type: "POST",
			dataType: "JSON",
			url: "{:U('core/task/addLog')}",
			data: {task_id : task_id, title : title , content : content , select_option_value : select_option_value , status_type : 'send_back'},
			success: function (data) {
				alert(data.info);
				$("#alert").modal("hide")
				location.href="{:U('core/task/view','id='.$task_id)}";
			},
			error: function(data) {
				alert(data.info);
			}
		});
	});
</script>